home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / apps / 356 / applic / 2columns.doc next >
Text File  |  1989-02-05  |  23KB  |  481 lines

  1.      TWO COLUMN PRINTER (2COLUMNS.PRG) by Jonathan Corey
  2.                        Version 2  (1/89)
  3.  
  4. INTRODUCTION
  5.     This program prints text (ASCII) files in two "magazine
  6. style" columns and has an option for easy two sided printing
  7. on continuous form paper.  Files printed this way use much
  8. less paper and are easier to refer to than those printed
  9. normally.  It works very well for printing program source
  10. code listings, program documentation, bulletin board captures
  11. and "online" magazines.  1stWord format files (not Plus) can
  12. be printed although the program will first convert them to
  13. ASCII format and so most of their internal formatting will be
  14. lost.  It works in all resolutions.
  15.  
  16.    Printer codes are read from a data file (usually
  17. 2COLUMNS.DAT).  Instructions for modifying printer codes to
  18. suit your printer are given in a later section of this file. 
  19. Data files for several different printers have been provided.
  20.  
  21.    TWO COLUMN PRINTER was developed on a 1040 ST.  The
  22. primary printer used during development was an Epson FX-85
  23. but recently much work has been done using a HP Deskjet (no
  24. font cards).  It was written in GFA BASIC (Ver 2.02) and
  25. compiled with the GFA BASIC Compiler (Ver 2.02).
  26.  
  27.    Send me (Jonathan Corey) any comments, questions, or
  28. suggestions by directing EMAIL on GEnie to address JWC-OEO.  
  29.  
  30. ENHANCEMENTS
  31.    There have been two major enhancements to the program in
  32. this version (Ver 2).  
  33.    1st...Output can now be directed to a disk file instead of
  34. only to the printer.  The processing of several files in one
  35. session goes much more quickly this way.  The output file can
  36. be printed with the desktop "Print" option or via a print
  37. spooler.  Several files can be combined in one output file.
  38.    2nd...An option has been added which reformats paragraphs
  39. that have lines too long to fit into a column.  This option
  40. works very well with loosely formatted documents like the one
  41. you are now reading, but should not be used with files such
  42. as program source code that should never have the text of one
  43. line combined with that of another. 
  44.  
  45.    Other improvements include:  Columns can now be more than
  46. 74 lines long; The various print options are now chosen with
  47. a dialog box rather than by the old maze of alert boxes (a
  48. RSC file now accompanies the program);  Columns are shifted
  49. towards the outside in order to maximize space for binding
  50. sheets along their inside edge (recommended); Previously
  51. chosen column dimensions are retained as defaults; Some
  52. obscure bugs have been squashed; And the line splitting
  53. routine has been improved.
  54.  
  55. PRINTER DATA COMPATIBILITY
  56.    Printer data files from Version 1 will also work with
  57. version 2.  However, to take full advantage of new features
  58. some minor modifications should be made to them.  See the
  59. items marked with an asterisk (*) in the Printer Codes
  60. section below.
  61.  
  62. FITTING A FILE INTO COLUMNS
  63.     The basic strategy this program uses to fit files into
  64. columns is simple.  It prints as much of a file line on one
  65. column line as possible; then if there's any of it left, it
  66. prints the rest on the next.  This leftover portion will
  67. either be combined with the next file line or will be left to
  68. become a column line all by itself.  Whether it is combined
  69. or left alone depends on the type of file being printed.  The
  70. type of file being printed also determines exactly where and
  71. how any line splitting is done.
  72.  
  73.     TWO COLUMN PRINTER handles program source code listings
  74. differently than other files although it's not very clever
  75. about determining what's source code and what's not.  It will
  76. assume that if a file has an extension of TXT or DOC it's
  77. not, otherwise it just asks "Is this source code?".  If it
  78. is, choose YES.  Even if it's not, you may occasionally want
  79. to lie and say it is because you would like it to be treated
  80. as if it were.  
  81.  
  82.     With program source code, the leftover portion of a split
  83. line never gets combined with another file line.  Also, all
  84. split lines and continuations of split lines are clearly
  85. marked.  For other types of files, line splitting will not
  86. always be clearly marked but it will occur in a much smoother
  87. and more uncluttered manner; also, the Paragraph Reformat
  88. option is available.
  89.  
  90.     When the Paragraph Reformat option has been chosen, any
  91. leftover portion of one file line is combined with the next
  92. file line.  This often makes the new line too long for a
  93. column as well, and a chain reaction of sorts is started that
  94. may not stop until the end of the current paragraph.  It will
  95. ALWAYS stop there.  The paragraph therefore essentially ends
  96. up being reformatted with narrower margins, hence the name of
  97. this option.  
  98.  
  99.     For the masochistically curious, the different types of
  100. line splitting are explained in more detail in a later
  101. section.
  102.  
  103.     It's best to minimize the amount of line splitting that
  104. occurs so columns should usually be set as wide as possible. 
  105. Does this mean that columns should always be set at their
  106. maximum width?  That depends on how you want to bind the
  107. pages together.  With maximum width columns, margins become
  108. very small which leaves very little room to bind them along
  109. their inner edge.  Since inner edge binding is usually the
  110. best method, the default settings of column width are set a
  111. few characters short of maximum with each type size.
  112.  
  113.    Before beginning to print, the program will indicate how
  114. many, if any, of the file lines were too long to fit the
  115. columns or how many paragraphs had to be reformatted.  At
  116. that point you will be given the option of either printing
  117. the file, reformatting it with wider columns, or exiting the
  118. program.
  119.  
  120.  
  121. COLUMN LENGTH and LINE SPACING
  122.    If columns are set too long to fit on a sheet of paper the
  123. whole output becomes essentially useless.  To help avoid
  124. this, Version 1 of TWO COLUMN PRINTER would not allow columns
  125. to be more than 74 lines long.  The default maximum column
  126. length with version 2 is a bit smaller at 72 lines but it can
  127. be changed to any value up to 99.  To change from the
  128. default, the desired value is added to the printer data file.
  129. A different maximum column length can be set for each type
  130. size.
  131.  
  132.     Maximum column lengths are determined by how close a
  133. printer can print to the top and bottom of a page, and the
  134. line spacing of the print.  With this program, printing is
  135. usually done with a line spacing close to 7 lines per inch
  136. (the codes for this spacing come from the printer data file). 
  137. Columns can be around 72 lines long on 11 inch continuous
  138. form paper with this spacing.  When columns are set to be 60
  139. lines long or less the program usually shifts to a spacing of
  140. 6 lines per inch (the "normal" spacing for most printers).
  141.  
  142.    If you wish to use some other line spacing you will need
  143. to add the necessary printer codes for it to the other codes
  144. used to set a particular type size/font.  When using type
  145. sizes that include a line spacing in their definition, only
  146. that line spacing can be used.  The most useful "other" line
  147. spacing is probably 8 lines per inch.  While a line spacing
  148. of 8 lines per inch is awfully cramped with fonts of normal
  149. height, it works fine when fonts of about 7 points or shorter
  150. are used. (Point size is a measure of the how tall a letter
  151. is, 7 point type is pretty short.)  When you use 8 lines per
  152. inch line spacing, printed columns can be around 84 lines
  153. long with most printers.  Most of the printer data files
  154. supplied with this program include at least one "8 line/inch"
  155. type size.
  156.  
  157.     Exactly how many lines long can columns be with your
  158. printer?  If it's not one for which I have included a data
  159. file, then I don't know.  The default setting is safe to use
  160. with most printers but if you want a more specific value you
  161. will have to figure it out for yourself.  A file has been
  162. included with TWO COLUMN PRINTER to help you with this.  It's
  163. called LPC_TEST (LPC = Lines Per Column).  It's just 96 short
  164. lines consisting mainly of line numbers.  Run it through TWO
  165. COLUMN PRINTER, choosing unequal length columns, and see how
  166. many lines your printer can fit onto a page.  You will have
  167. to change the "Maximum Lines per Column" entry in your
  168. printer data file to try larger values.  Do the test with
  169. both continuous and single sheets.  CAUTION: If your printer
  170. won't let you turn its end-of-paper sensor off (like the HP
  171. Deskjet and Epson LQ-1050) choose a value ONE LESS than that
  172. which will actually print on a single sheet.
  173.  
  174.    With most printers you will probably be able to get more
  175. lines on a sheet with continuous form paper than cut sheets. 
  176. Choose whichever value you want but remember, the final sheet
  177. of continuous form paper will usually behave the same as cut
  178. sheet paper.  It is for this reason that default values of
  179. column length have been set to be a few lines shorter than
  180. the maximum.  The non-default values that are included the
  181. printer data files supplied with this program are all for 11
  182. inch continuous form paper (except the Deskjet of course). 
  183. You may not be able to get that many lines on single sheets
  184. or the last sheet of continuous form paper.
  185.  
  186.  
  187. TWO SIDED PRINTING
  188.    Printing on both sides of the paper has attractive
  189. advantages.  It is much easier to refer to what you have
  190. printed, and paper usage is cut almost in half saving both
  191. money and storage space.  Even though TWO COLUMN PRINTER can
  192. simplify two sided printing on continuous form paper quite a
  193. bit, more effort is required than with single sided printing. 
  194. If it is hard to load paper into your printer it may not be
  195. worth it to you.  It is worth trying however.
  196.  
  197.     When the option for printing on both sides of continuous
  198. form paper has been chosen, the program will first print all
  199. the odd numbered pages and then, after a pause to allow you
  200. to turn the paper over, it will print the even numbered ones.
  201. The page number, name of the file, and (optionally) the date
  202. are printed on the top of each page to help keep things
  203. straight.  When printing to disk, the even and odd pages of
  204. two sided files go into separate output files.  Several files
  205. can be put into one output file further reducing the paper
  206. handling required to print them.  Never combine files
  207. formatted for one and two sided printing into the same output
  208. file.
  209.  
  210.  
  211. LINE SPLITTING
  212.    When a line is too long for a column a portion of it gets
  213. moved to a new line.  After that two things can happen.  The
  214. excess will either be left to become a new line all by
  215. itself, or it will be combined with the next line down. It
  216. will only be combined with the next line when the paragraph
  217. reformat option has been turned on AND the next line is not
  218. blank or does not begin with one or more spaces.
  219.  
  220.    The point at which an excessively long line is split is
  221. determined as follows...  
  222.    With most files, the last eight characters before the edge
  223. of a column are searched for a blank space.  The split will
  224. occur at the first one found.  If there are no spaces in the
  225. last eight characters the last word will be hyphenated
  226. (expediently) and the line split after the hyphenation.  One
  227. exception to this occurs when the character just before the
  228. hyphenation is a number (actually if it has an ASCII value
  229. less than 65).  In this case a vertical bar "|" is used
  230. instead of a hyphen since the hyphen could be confused with a
  231. minus sign when next to a number.  A vertical bar is also
  232. added at the start of the next line to indicate than a number
  233. has been split.
  234.    A different method is used with source code listings
  235. because source code may not have all that many blank spaces
  236. (GFA BASIC for example) and any dashes added as part of
  237. hyphenation could easily be confused with minus signs.  When
  238. you have declared a file as being program source code any
  239. necessary splitting will occur three characters short of the
  240. point at which a line becomes too long for a column (without
  241. regard for the context of the line).  To indicate a split has
  242. occurred the characters ``> are added at the split point.  To
  243. indicated a line is the continuation of the previous one, the
  244. characters >`` are added in front of it.  
  245.  
  246.  
  247. FORMATTED TEXT FILES
  248.    Some text files have been formatted to have a nice formal
  249. appearance when printed straight from the desktop.  They
  250. often have an indented left margin so that printing begins
  251. several spaces in from the left side of the paper.  This
  252. looks better with normal printing but only wastes paper here. 
  253. TWO COLUMN PRINTER has an option which will enable you to
  254. easily check for and get rid of any left margin indent. 
  255. Unfortunately the paragraph reformat option does not work
  256. with files that have indented left margins.  However, once
  257. the indent has been eliminated the file is not likely to have
  258. any lines too long to fit the columns.
  259.  
  260.    Formatted text files often contain page numbers which are
  261. sometimes preceded by a number of blank lines.  You might
  262. want to eliminate these blank lines with a word processor or
  263. text editor before printing with TWO COLUMN PRINTER as they
  264. will just waste paper.   Keep the page numbers though,  they
  265. won't correspond to the actual page numbers when printed with
  266. TWO COLUMN PRINTER but can serve as a useful reference,
  267. especially if the file contains an index.
  268.  
  269.  
  270. MISCELLANEOUS
  271.    You can change the extension shown in the file selector
  272. box to the wildcard "*" by clicking on OK without first
  273. selecting a file.  This works best if it's done before
  274. setting a different drive or folder.
  275.  
  276.    The program does some error checking on the file you ask
  277. it to print and rejects those it identifies as inappropriate
  278. (not ASCII or 1STWORD format).  If for some reason it rejects
  279. a file you are sure should work (it is readable when
  280. displayed by the desktop SHOW option), change the extension
  281. of the file name to .TXT or .LST and try again.  No error
  282. checking for file type is done on files with these
  283. extensions.
  284.  
  285.    Any TAB's found in a file are changed to three blank
  286. spaces before printing.
  287.  
  288.  
  289. _____________________________________________________________
  290.  
  291.                  *** Printer Codes ***
  292.  
  293. GENERAL
  294.    Printer data files for several printers have been
  295. provided.  If your printer is Epson compatible (or you have a
  296. Deskjet) then one them will likely work fine.  If not, you
  297. will have to do some editing.  For this you will need your
  298. printer manual.  Edit a backup copy of one of these files
  299. using a text editor or word processor and save it as a simple
  300. text (ASCII) file (not in any special word processor mode)
  301. giving it a new name. 
  302.  
  303.    The data files provided have descriptive names such as
  304. EPSON_FX.DAT (all use the extension DAT).  They are designed
  305. for the standard mode of these printers so if you have one of
  306. them but have its DIP switches set for IBM mode you may need
  307. to modify the codes accordingly.  The Epson-FX codes which
  308. were developed on an FX-85 have also been tested on an Epson
  309. LX-800 and FX-80 and work quit well.  The LQ codes were
  310. developed on an Epson LQ-1050.  Some earlier Epson LQ
  311. printers (such as the LQ-1500) cannot do NLQ with type sizes
  312. less than 12 CPI (Characters Per Inch).  Double strike should
  313. be used instead of NLQ for "enhanced printing" with these
  314. printers (necessary codes for this are shown in the remarks
  315. section of this data file).  The DESKJET codes were derived
  316. on a Hewlett-Packard Deskjet with no font cards installed. 
  317. The Panasonic KX-P1091i codes have not been tested on other
  318. models of the same brand.  The STAR SG10 codes are based only
  319. on the printer manual and have not been tested.
  320.  
  321.    Unless you have two (or more) printers that use different
  322. codes you may want to change the name of your printers data
  323. file to 2COLUMNS.DAT.  You will no longer have to select a
  324. data file each time the program is run this way since the
  325. program automatically loads 2COLUMNS.DAT if it finds it on
  326. the same disk (and in the same folder) as the program.
  327.  
  328.  
  329. EDITING A PRINTER CODE FILE
  330.    Follow the data format exactly as shown.  Use 3 digit
  331. decimal ASCII values for printer codes.  Separate them with a
  332. single space and put a comma after the last one.  Remarks
  333. (optional) may follow the comma (mandatory).  THERE CAN BE NO
  334. OTHER COMMAS ANYWHERE ELSE IN THE DATA SECTION, including in
  335. the remarks themselves.  The "-----CODES AND DEFAULTS----"
  336. line needs to be left intact. 
  337.  
  338. Example:  A printer function which requires the code "Escape
  339. A" would be encoded as: 
  340.  
  341. 027 065, REMARKS 
  342.  
  343. (the ASCII value of Escape is 027, that of A is 065.)  Again,
  344. no commas are allowed in the remarks themselves.
  345.  
  346.    Printer functions requiring multiple codes are allowed. In
  347. the Epson FX version supplied with the program the codes for
  348. type size #2 contain both the codes for compressed type
  349. ( 027 015 ) and for wider margins with this type size 
  350. ( 027 081 137 ).  The only limitation is that all codes and
  351. the remarks that follow must fit on a single line (which can
  352. be up to 255 characters long).
  353.  
  354.  
  355. * Line-by-line editing instructions are given below.  Those
  356. entries preceded by an asterisk (*) have changed since
  357. version 1.
  358.  
  359. Paper-Out Sensor
  360.    The first two entries in the "CODES AND DEFAULTS" section
  361. are:  1) Disable (turn off) the paper-out sensor, and  2)
  362. Enable (turn on) the paper-out sensor.  If your printer does
  363. not allow its paper-out sensor to be turned off, just enter a
  364. single blank space followed by a comma (see DESKJET.DAT).
  365.  
  366. Line Spacing
  367.    Next enter the codes for 7 line per inch line spacing. 
  368. You will probably find that you can only come up with a value
  369. equivalent to slightly more or slightly less than this.
  370. (7 lines per inch is a spacing of 0.143 inch)  In this case
  371. choose the next smallest value available.  For example the
  372. Epson-FX definition uses 10/72 (0.139) inch spacing.
  373.  
  374. * Printer Initialization
  375.    To work properly with this program your printer has to
  376. have certain settings in effect before printing begins. 
  377. Initial conditions needed are: A pitch of 10 characters per
  378. inch (CPI), Draft mode, 6 lines per inch line spacing, and
  379. top-of-form reset.  An "initialize" sequence is sent to
  380. ensure that these conditions are met.
  381.    The codes which need to be included in this sequence vary
  382. somewhat from printer to printer and also will depend on how
  383. you normally have your printer's DIP switches and control
  384. panel buttons set.
  385.    To do the top-of-form setting, add the codes which are
  386. described in most printer manuals as Initialize Printer or
  387. Reset Printer.  To be safe you should also include the codes
  388. to set 10 CPI and Draft Mode printing.  
  389.    If you have a type size that uses the Super/Sub script
  390. font of your printer you will also need to add the codes to
  391. cancel this font to the initialize printer sequence.  The
  392. Epson FX definition does this. (Alternately, but not as
  393. simply, you could add "cancel super/sub script font" codes to
  394. each non-super/sub script font definition.)
  395.    Unless you have your printers DIP switch set at 8 lines
  396. per inch you will not need to enter the codes for 6 lines per
  397. inch line spacing.
  398.    The Initialize printer sequence for the HP Deskjet
  399. contains some other codes as well.  See the "Note" at the
  400. bottom of its data file.
  401.    Some printers (such as the Panasonic KX-P1091i) have
  402. control panel settings which cannot be changed by software.
  403. TWO COLUMN PRINTER cannot function properly when these are
  404. set to NLQ mode.  You must switch to draft mode (the
  405. Panasonic KX-P1091i calls this "Std Pgm") before printing.
  406.  
  407. Skip-Over-Perforations
  408.    Enter the codes to turn OFF your printers Skip-Over-
  409. Perforations function.  TWO COLUMN PRINTER handles page
  410. breaks itself and if you leave "skip over perforations" on it
  411. will interfere with the proper operation of the program
  412. (a lot).
  413.  
  414. * Fancy Print for the Heading
  415.    TWO COLUMN PRINTER puts a heading consisting of the name
  416. of the file being printed (and optionally the current date)
  417. on the first printed page.  For this to print properly you
  418. will need to enter the codes for Double Width (expanded)
  419. printing.  If you do not use Double Width printing (or 5
  420. pitch in the case of the Deskjet) the heading will not be
  421. centered properly.
  422.  
  423. Enhanced Print
  424.    The entry for Enhanced Print affects the main body of the
  425. text.  Choices for this are either Near Letter Quality (NLQ)
  426. or Double Strike printing.  Choose NLQ only if it works with
  427. all the type sizes included in your data file, otherwise
  428. choose Double Strike.
  429.  
  430. Default Extension
  431.    Only files with the extension you enter here will be shown
  432. in the file selector box the first time you are prompted for
  433. a file name to print.  This entry must not exceed three
  434. characters and must be surrounded by quotes.  If you prefer
  435. that all files be shown then enter "*" or just "" here (don't
  436. forget the comma).
  437.  
  438. Number of Type Sizes
  439.    Five is the maximum.  MAKE SURE THIS NUMBER IS NOT LARGER
  440. THAN THE NUMBER OF TYPE SIZES IN YOUR DATA FILE.  It can be
  441. smaller though since the program will only read in this
  442. number of type sizes and will ignore the rest.  If you choose
  443. to use less then the maximum number of type sizes (5) you may
  444. (although it is not necessary to) delete the entries for any
  445. unneeded codes.  Do not delete any other lines in the codes
  446. section. 
  447.  
  448. * Entries for Each Type Size
  449.    The name of each type size should not exceed 25
  450. characters.  Other than the fact that no commas are allowed
  451. you can put any descriptive information you like here.  The
  452. name must be surrounded by quotation marks (these do not
  453. count as characters in the name).  Like all other entries the
  454. name MUST be followed by a comma and optional descriptive
  455. remarks may follow the comma.
  456.    The codes used to select a type size can also contain the
  457. codes for a particular line spacing.  If included, only that
  458. line spacing will available with this type size.
  459.    The entry for the number of characters that will fit on a
  460. full line is mandatory.  Take this value from your printer
  461. manual if possible (sometimes given as the maximum value
  462. allowed for the right margin).  If you cannot find it there
  463. then try 160 for 20 CPI, 136 for 17 CPI, 120 for 15 CPI, 96
  464. for 12 CPI, and 80 for 10 CPI.  Arithmetically inclined
  465. individuals will be able to discern a pattern here.  These
  466. values are for narrow carriage printers.  If you are using a
  467. wide carriage model you can probably add a character or two
  468. to them.
  469.    On the next line you may enter a number equal to the
  470. maximum column length possible with this type size (99 is
  471. maximum).  This optional entry is useful if you have a
  472. particular line spacing included in the codes for this type
  473. size, if your printer can print more or cannot print as many
  474. lines per column as the default value, or if you will be
  475. using something other than 11 inch paper.  The default value
  476. is 72 lines per column and if no entry is made here the
  477. default value will be the maximum column length allowed. 
  478. Like all entries, it must be followed by a comma and remarks
  479. may follow the comma.
  480.  
  481.    Proportionally spaced fonts cannot be used.